package routers

import (
	"net/http"
	"shqsoft.cn/pasnj/base"

	"github.com/labstack/echo"
)

//修改理财产品中收费率
func UpdateFapuZsfl(c echo.Context) error {
	puid := c.FormValue("NO")
	if puid == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "请选择理财产品")
	}
	zsfl := c.FormValue("ZSFL")
	if zsfl == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "中收费率不能为空")
	}
	tx := base.DB.Begin()
	sql := "UPDATE T_INDI_FAPU SET ZSFL=? WHERE PUID=?"
	tx.Exec(sql, zsfl, puid)
	tx.Commit()
	return c.JSON(http.StatusOK, "OK")
}

//修改同业FTP
func UpdateTyywFtp(c echo.Context) error {
	jlid := c.FormValue("NO")
	if jlid == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "请选择同业业务")
	}
	ftp := c.FormValue("ZSFL")
	if ftp == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "FTP不能为空")
	}
	tx := base.DB.Begin()
	sql := "UPDATE t_CM_IBANK_CUST_BIZ_SUM_M SET FTP=? WHERE JLID=?"
	tx.Exec(sql, ftp, jlid)
	tx.Commit()
	return c.JSON(http.StatusOK, "OK")
}
